﻿using Avalonia.Controls;
using Avalonia.Interactivity;

namespace Digitalmes.AvaloniaUI.Views;

public partial class TitleBarRightContent : UserControl
{
    public TitleBarRightContent()
    {
        InitializeComponent();
    }

    private async void OpenSettingDialog(object? sender, RoutedEventArgs e)
    {
        var options = new DialogOptions()
        {
            Title = "设置",
            Mode = DialogMode.Info,
            Button = DialogButton.OKCancel,
            ShowInTaskBar = false,
            IsCloseButtonVisible = true,
            StartupLocation = WindowStartupLocation.CenterScreen,
            CanDragMove = true,
            CanResize = true,
        };

        var vm = App.Current!.Services.GetRequiredService<DialogSettingsViewModel>();
        await Dialog.ShowModal<DialogSettingsPage, DialogSettingsViewModel>(vm, options: options);
    }
}
